#!/bin/bash
source ../../common/common.sh

echo "===INIT==UBUNTU=WINEQQ==="
sudo echo "SUDO ROOT"

DownFileA=deepinwine-qqintl_0.1.3-2_all.deb
DownFileB=wine-qqintl_0.1.3-2_i386.deb
DownUrlA=http://test.packages.linuxdeepin.com/deepin/pool/non-free/d/deepinwine-qqintl/deepinwine-qqintl_0.1.3-2_all.deb
DownUrlB=http://test.packages.linuxdeepin.com/deepin/pool/non-free/d/deepinwine-qqintl/wine-qqintl_0.1.3-2_i386.deb
TempDir=/works/downloads/WineQQ

if [ ! -f $TempDir/$DownFile ]; then
  show t "安装 WineQQ"
  show i "下载 WineQQ 安装文件"
  chk_mkdir $TempDir
  chk_downfile $DownUrlA $TempDir/$DownFileA yes
  chk_downfile $DownUrlB $TempDir/$DownFileB yes
  if [ -f $TempDir/$DownFileA -a -f $TempDir/$DownFileB ]; then
    show s "Download $TempDir/$DownFileA  OK."
    show s "Download $TempDir/$DownFileB  OK."
    sudo dpkg -i $TempDir/$DownFileA $TempDir/$DownFileB
    sudo apt-get -f install
    sudo dpkg -i $TempDir/$DownFileA $TempDir/$DownFileB
  fi
fi

exit 0

show t "安装Win32兼容库"
install_apt_pack "force|libgtk2.0-0:i386 libp11-kit-gnome-keyring:i386"

if [ ! -f /usr/local/bin/getlibs ]; then
  wget https://raw.github.com/spaetzlecode/getlibs/master/getlibs 
  sudo chown root:root getlibs 
  sudo chmod +x getlibs 
  sudo mv -n getlibs /usr/local/bin 
fi

if [ ! -d /usr/lib/i386-linux-gnu/pkcs11/ ]; then
  sudo mkdir -p /usr/lib/i386-linux-gnu/pkcs11/ 
  sudo ln -s /usr/lib32/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so
  sudo ln -s /usr/lib32/i386-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/i386-linux-gnu/pkcs11/p11-kit-trust.so
fi

# 提示 Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated. 打开 /etc/fonts/conf.d/50-user.conf 的 deprecated="yes" 改为deprecated="no"

DownFile=WineQQ2013SP6-20140102-Longene.deb
DownUrl=http://www.longene.org/download/WineQQ2013SP6-20140102-Longene.deb
TempDir=/works/downloads/WineQQ

if [ ! -f $TempDir/$DownFile ]; then
  show t "安装 WineQQ"
  show i "下载 WineQQ 安装文件"
  chk_mkdir $TempDir
  chk_downfile $DownUrl $TempDir/$DownFile yes
  if [ -f $TempDir/$DownFile ]; then
    show s "Download $TempDir/$DownFile OK."
    sudo dpkg -i $TempDir/$DownFile
  fi
fi

